/*自己写的，十个测试对一个；没有理解题意，还是不能直接排序之后做*/
#include <bits/stdc++.h>

using namespace std;
const int M = 5 * 100000;
int n, w[M], ans;
int a[M];
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> w[i];
	}
	sort(w, w + n);
	for (int i = 0; i < n; i++)
	{
		a[0] = 1;
		if (w[i] == w[i + 1])
			a[i + 1] = a[i];
		else if (w[i] < w[i + 1])
			a[i + 1] = a[i] + 1;
	}
	for (int i = 0; i < n; i++)
	{
		ans += a[i];
	}
	cout << ans;
	return 0;
}
/*参考题解

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int N = 5e5 + 10;
const int mod = 1e9 + 7;
//正反面枚举一次
int main()
{


	int n;
	cin >> n;
	int a[N], b[N];
	LL sum = 0;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
		b[i] = 1;
	}
	for (int i = 1; i < n; i++)
	{
		if (a[i] > a[i - 1])b[i] = b[i - 1] + 1;
		if (a[i] == a[i - 1]) b[i] = b[i - 1];
	}
	for (int i = n - 2; i >= 0; i--)
	{
		if (a[i] > a[i + 1])
		{
			b[i] = max(b[i], b[i + 1] + 1);
		}
	}
	for (int i = 0; i < n; i++) sum += b[i];
	cout << sum;

	return 0;
}

*/